//
//  SVButton.m
//  
//
//  Created by iMac on 16/2/29.
//
//

#import "SVButton.h"
@interface SVButton()
{
    UILabel *m_labTitle;
    UILabel *m_labNum;
}
@end
@implementation SVButton
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self addSubviewsWith:frame];
    }
    return self;
}
-(void)addSubviewsWith:(CGRect)frame
{
    CGSize sizeBtn=frame.size;
    m_labTitle=[[UILabel alloc]initWithFrame:CGRectMake(0, 10, sizeBtn.width, 15)];
    [m_labTitle setTextColor:TEXT_MIDDLE];
    [m_labTitle setFont:[UIFont LightFontOfSize:15]];
    [m_labTitle setTextAlignment:NSTextAlignmentCenter];
    [self addSubview:m_labTitle];
    
    m_labNum=[[UILabel alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(m_labTitle.frame)+kDistance, sizeBtn.width, 20)];
    [m_labNum setTextColor:TEXT_MIDDLE];
    [m_labNum setFont:[UIFont FontOfSize:22]];
    [m_labNum setTextAlignment:NSTextAlignmentCenter];
    [self addSubview:m_labNum];
}
-(void)setDataWith:(NSString *)title and:(NSString *)num
{
    [m_labTitle setText:title];
    [m_labNum setText:num];
}
-(void)setSelected:(BOOL)selected
{
    if (selected) {
        [m_labTitle setTextColor:MAIN_COLOR];
        [m_labNum setTextColor:MAIN_COLOR];
        [m_labTitle setFont:[UIFont LightFontOfSize:16]];
    }else{
        [m_labTitle setTextColor:TEXT_MIDDLE];
        [m_labTitle setFont:[UIFont LightFontOfSize:15]];
        [m_labNum setTextColor:TEXT_MIDDLE];
    }
}
-(void)btnReloadNum:(NSString *)num
{
    [m_labNum setText:num];
}

@end




